package org.nerve.kotlin.boot.controller

import org.nerve.kotlin.boot.service.IndexService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

/**
 * Created by zengxm on 2017/7/24.
 */
@RestController
class IndexController @Autowired() constructor(val service:IndexService,
                                               val context:ApplicationContext) {

    @RequestMapping
    fun index() = "${service.index()}, 当前bean总数为 ${context.beanDefinitionCount}:${context.beanDefinitionNames}"

    @RequestMapping("users")
    fun userList() = service.userList()

    /**
     *
     */
    @RequestMapping("setting")
    fun settings() = service.settings()
}